﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Hotnet.Entity.PictureCategory>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	图片分类列表 - 图片分类管理 - 图片管理 - Hotent后台管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2>图片分类管理</h2>

	<table width="100%" class="ma list">
		<tr>
			<th>
				序号
			</th>
			<th>
				分类编号
			</th>
			<th>
				分类名称
			</th>
			<th>
				分类Tag
			</th>
			<th>
				分类排序
			</th>
			<th>
				操作
			</th>
		</tr>

	<% 
		int id = 1;
		foreach (var item in Model) 
		{ 
	%>
	
		<tr>
			<td>
				<%=id++ %>
			</td>
			<td>
				<%= Html.Encode(item.CategoryID) %>
			</td>
			<td>
				<%= Html.Encode(item.Name) %>
			</td>
			<td>
				<%= Html.Encode(item.Tag) %>
			</td>
			<td>
				<%=item.OrderNo %>
			</td>
			<td>
				<a href="javascript:editCategory(<%=item.CategoryID %>, '<%=item.Name%>', <%=item.OrderNo %>,'<%=item.Tag %>');">编辑</a> |
				<a href="javascript:confirmDelete('删除该分类会删除分类下的所有图片组,以及图片.删除操作不能恢复.确认删除?', '/AdminPictureCategory/Delete/', <%=item.CategoryID %>);" >删除</a> 
			</td>
		</tr>
	
	<% } %>

	</table>

	<p>
		<a href="javascript:createCategory();" class="b1 p5 dbk blik fl">新建图片分类</a>
	</p>
	
	<div id="createWindow" class="dn">
		<%using (Html.BeginForm("Edit", "AdminPictureCategory", FormMethod.Post, new { id = "formMutiple" }))
		  {%>
		<input type="hidden" id="categoryId" name="categoryId"/>
		<div class="tac"><span class="mr3">分类名称:</span><input type="text" id="categoryName" name="name" /></div>
		<div class="tac"><span class="mr3">分类排序:</span><input type="text" id="orderNo" name="orderNo" /></div>
		<div class="tac"><span class="mr3">分类Tag:</span><input type="text" id="tag" name="tag" /></div>
		<div class="tac mt5">
			<input type="submit" value="确定" class="ml3 boxy-button"/>
			<input type="button" value="关闭" class="ml3 boxy-button" onclick="closeWindow();"/>
		</div>
		<% } %>
	</div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
	<script type="text/javascript">

		var boxy = null;

		function showWindow(title) {
			if (boxy == null)
				boxy = new Boxy($('#createWindow'), { modal: false, "title": title, closeText: '[×]', draggable: true }).resize(310, 80);
			else {
				boxy.setTitle(title);
				boxy.show();
			}
		}

		function closeWindow() {
			if (boxy != null)
				boxy.hide();
		}
		
		function createCategory(){
			$("#formMutiple").attr("action", "/AdminPictureCategory/Create/");
			document.getElementById("formMutiple").reset();
			showWindow("新建图片分类");
		}

		function editCategory(categoryId, name, orderNo,tag) {
			$("#formMutiple").attr("action", "/AdminPictureCategory/Edit/");
			$("#categoryId").val(categoryId);
			$("#categoryName").val(name);
			$("#orderNo").val(orderNo);
			$("#tag").val(tag);
			showWindow("编辑图片分类");
		}		
	</script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="StyleContent" runat="server">
</asp:Content>

